openArchitectureWare.org

oAW has moved to Eclipse.

At this site you will find information about the outdated version openArchitectureWare 4, only.
Please read our letter of intent for further information.

 

 Forum Index > openArchitectureWare > oAW 4 Xtext Support New Topic Post Reply
 visibility restriction with codeAssist
 |  Printable Version
Fredy
 Tuesday, April 14 2009 @ 05:08 PM CEST (Read 750 times)  
Forum Advanced User
Advanced User

Status: offline

Registered: 11/11/06
Posts: 62

Hi all,
I've somthing like this:

System :
      "system" systemname=ID
      "{"
      		(types+=SystemType)*
			(components+=Component)*
      "}";

SystemType :
      ValueObject | Enumeration; 

Component :
	"component" componentName=ID
	"{"
		(types+=ComponentType)*
		(providedPort+=Port)*
	"}";

ComponentType :
      ValueObject | Enumeration; 

Port : "port" name=ID
	"{"
		(types+=PortType)*
		(services+=Service)*
	"}";

PortType :
      ValueObject | Enumeration; 

...
...

ValueObject : ("rem" description=STRING)? ("docUrl" docUrl=STRING)? "valueObject" name=ID "{"
      (enumerations+=EnumerationRef)*
      (voAttributes+=ValueObjectRef)*
"}";

ValueObjectRef :
      ("rem" description=STRING)? "voRef" type=[ValueObject] (multiplicity=Multiplicity)? name=ID ";";


The ValueObjects in scope System should only see the ValueObjects from scope System as ValueObjectRef.

The ValueObjects in scope Component should only see the ValueObjects from scope System and Component as ValueObjectRef.

and so on...

How can I realise this as ContentAssist and as Check Constraint? And how does this also works, if I import the Types (seperate Model File).

Are there any dokumentations or samples about something ?

Thanks Fredy


 
Profile Email Website
Quote
Christian Dietrich
 Tuesday, April 14 2009 @ 05:11 PM CEST  
Forum Expert
Expert

Status: online

Registered: 10/11/06
Posts: 580

Not to reinvent the wheel have a look at http://code.google.com/p/metamodelsemantics/. there is a scoping feature included that should help you to solve your problem.

and if you don't want to use it as solution you can still use is as inspiration.


 
Profile Email Website
Quote
Fredy
 Tuesday, April 21 2009 @ 08:48 AM CEST  
Forum Advanced User
Advanced User

Status: offline

Registered: 11/11/06
Posts: 62

Hi Christian,
thank you very much for this hint! Very great tool !

But in praxis there are some pitfalls.

I've installed a standard eclipse 3.2.4 with oaw 4.3.1.
Then annotated my metamodel like this:

semantic annotation for
"platform:/resource/kdgComponents.dsl/src-gen/de/xyz/dsl/kdgComponents/kdgcomponentsdsl.ecore" 
{
	class ValueObject 
	{
		uniqueNames valueObjectRefs
	}
}


The generator generates "/kdgComponents.dsl/src/de/xyz/dsl/kdgComponents/Linking.ext"
link(emf::EObject this) :
	let all = allLocalElements() :
	all.typeSelect(kdgComponentsDsl::EnumerationRef).collect(e|e.link_type()) ->
	all.typeSelect(kdgComponentsDsl::ValueObjectRef).collect(e|e.link_type()) ->
	all.typeSelect(kdgComponentsDsl::ValueObjectParameter).collect(e|e.link_type()) ->
	all.typeSelect(kdgComponentsDsl::EnumerationParameter).collect(e|e.link_type()) ->
	null;


and there are some failures:
Couldn't find type kdgComponentsDsl::EnumerationParameter	Linking.ext	kdgComponents.dsl/src/de/kabeldeutschland/dsl/kdgComponents	line: 33	openArchitectureWare Problem
Couldn't find type kdgComponentsDsl::EnumerationRef	Linking.ext	kdgComponents.dsl/src/de/kabeldeutschland/dsl/kdgComponents	line: 30	openArchitectureWare Problem
Couldn't find type kdgComponentsDsl::ValueObjectParameter	Linking.ext	kdgComponents.dsl/src/de/kabeldeutschland/dsl/kdgComponents	line: 32	openArchitectureWare Problem
Couldn't find type kdgComponentsDsl::ValueObjectRef	Linking.ext	kdgComponents.dsl/src/de/kabeldeutschland/dsl/kdgComponents	line: 31	openArchitectureWare Problem


Do you have any idea what's going wrong? Is there a problem with my model?
Who besides Markus knows seman?

Thanks Fredy


 
Profile Email Website
Quote
Christian Dietrich
 Tuesday, April 21 2009 @ 10:44 AM CEST  
Forum Expert
Expert

Status: online

Registered: 10/11/06
Posts: 580

one question: kdgComponentsDsl is the name of you Xtext Model's Package?


 
Profile Email Website
Quote
Fredy
 Tuesday, April 21 2009 @ 12:30 PM CEST  
Forum Advanced User
Advanced User

Status: offline

Registered: 11/11/06
Posts: 62

I think not ?!

my dsl is in: src/kdgComponentsDsl.xtxt

generate.properties:
language.name=kdgComponentsDsl

Fredy


 
Profile Email Website
Quote
Christian Dietrich
 Tuesday, April 21 2009 @ 02:37 PM CEST  
Forum Expert
Expert

Status: online

Registered: 10/11/06
Posts: 580

Are the errors just in the .ext editor or in runtime too?


 
Profile Email Website
Quote
Fredy
 Tuesday, April 21 2009 @ 02:49 PM CEST  
Forum Advanced User
Advanced User

Status: offline

Registered: 11/11/06
Posts: 62

No refresh problem ;-)
it is also an error when executing the workflow in the runtime-woprkbench.

Fredy


 
Profile Email Website
Quote
Christian Dietrich
 Tuesday, April 21 2009 @ 03:27 PM CEST  
Forum Expert
Expert

Status: online

Registered: 10/11/06
Posts: 580

strange. and kdgComponentsDsl::EnumerationParameter and the other types exist in your xtext metamodel?


 
Profile Email Website
Quote
Christian Dietrich
 Tuesday, April 21 2009 @ 10:32 PM CEST  
Forum Expert
Expert

Status: online

Registered: 10/11/06
Posts: 580

Hi i did some additional reasearch. metamodelsemantics has problems with camelcase languagenames.
see http://code.google.com/p/metamodelsemantics/issues/detail?id=6

The best (fastest) way is to change the languagename to lower case

(otherwise you could check out metamodelsemantics and fix the
templates by writing «metamodelName.toLowerCase()»:: instead of «metamodelName»::


 
Profile Email Website
Quote
Content generated in: 0.57 seconds
New Topic Post Reply



 All times are CEST. The time is now 05:31 AM.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content